package kioschool.view.controlsimpl
{
	import flash.display.DisplayObject;
	import flash.display.Stage;
	
	import kioschool.view.controls.IPerspective;
	import kioschool.view.controls.ICommentPanel;
	import kioschool.view.controls.IControlsFactory;
	import kioschool.view.controls.INavigationPanel;
	import kioschool.view.controls.IRegimePanel;
	import kioschool.view.layout.ComponentLayout;

	/**
	 * Перспектива, предоставляемая платформой по умолчанию
	 * 
	 * @author Akimushkin Vasiliy
	 */ 
	public class DefaultPerspective implements IPerspective
	{
		public function placeComponents(stage:Stage, width:int, height:int, regimePanel:IRegimePanel, navigationPanel:INavigationPanel, commentPanel:ICommentPanel, workspace:DisplayObject):void{
			var mainLayout:ComponentLayout = new ComponentLayout(stage, width, height);
			
			var bg:DefaultBackground = new DefaultBackground();
			mainLayout.addComponent(bg, "bg", "0;0;root.width;root.height");
			
			var layout:ComponentLayout = bg.getLayout();			
			
			layout.addComponent(regimePanel.getView(), "regimePanel", "0;0;root.width;40");
			layout.addComponent(navigationPanel.getView(), "navigationPanel", "5;root.height-40;root.width-10;25");
			layout.addComponent(commentPanel.getView(), "commentPanel", "root.width-205;45;200;root.height-90");
			
			//фактически работает только положение, размеры определяются контентом
			mainLayout.addComponent(workspace, "workspace", "5;45;root.width-210;root.height-90");
			
			mainLayout.layout();
			
		}	
	}
}